package com.atguigu.day17.homework.h2;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/21 16:39
 * @注释
 */
public class StudentTest {
    public static void main(String[] args) {
        ArrayList<Student> students = new ArrayList<Student>();
        Scanner input = new Scanner(System.in);
        boolean flag = true;
        while (flag) {
            System.out.println("请输入姓名:");
            String name = input.next();
            System.out.println("请输入年龄:");
            int age = input.nextInt();
            students.add(new Student(name, age));
            System.out.println("请问是否继续录入学生信息(1继续/0取消):");
            int grade = input.nextInt();
            if (grade == 0) {
                flag = false;
            }
        }
        students.forEach(System.out::println);

    }
}
